{% extends 'admin/base.html' %}

{%load comm_extras %}

{% block head_soruce %}
<script type="text/javascript">
	var urlDelete = '{%url admin-tuangou-delete-json 88888888 %}';

	function delTuangou(id){
		if(!confirm('你确定要删除吗？')){return;}
		var url = urlDelete.replace('88888888', id);
		$.ajax({
			url: url,
			type: 'get',
			dataType: 'json',
			success: function(result, textStatus){
				if(result){
					if(result.success){
						window.location.reload();
					}else{
						alert(result.err_msg);
					}
				}else{
					alert('删除失败');
				}
			},
			error: function(xhr, textStatus, errorThrown){
			}
		});
	}

</script>
{% endblock %}

{% block main_content %}
	<img src="/static/productimgs/{{item.homeimage.thumburl}}" width="50" height="50" alt="{{item.title}}" />
	<h1>{{item.title}}---成功案例管理---<a href="{%url admin-tuangou-add item.id 0%}">添加成功案例</a></h1>
	<table class="Qtable">
		<tr>
			<td>团购数量</td>
			<td>团购网址</td>
			<td>团购时间</td>
			<td>供应商</td>
			<td>团购价</td>
			<td>团购网站名称</td>
			<td>团购说明</td>
			<td></td>
		</tr>
	{%for tuangou in tuangous %}
		<tr>
			<td>{{tuangou.tuan_salecount}}</td>
			<td><a href="{{tuangou.tuan_url}}" target="_blank">查看</a></td>
			<td>{{tuangou.tuan_saledate}}</td>
			<td>{{tuangou.supply.title}}</td>
			<td>{{tuangou.tuan_price}}</td>
			<td>{{tuangou.tuan_sitename}}</td>
			<td>{{tuangou.tuan_context}}</td>
			<td>
				<a href="{%url admin-tuangou-add item.id tuangou.id%}">编辑</a>
				<a href="javascript:void(0)" onclick="delTuangou({{tuangou.id}});">删除</a>
			</td>
		</tr>
	{%endfor%}
	</table>
	{% paginator 5 %}
{% endblock %}
